'''
文本备份
丢弃调  为测试的文件
'''

# 打开文件
fr = open("D:/project/pythonProject/python/文件操作/文本/备份源文件.txt", "r", encoding="UTF-8")

# 写新的文件
fw = open("D:/project/pythonProject/python/文件操作/文本/备份之后文件.txt.bak", "w", encoding="UTF-8")

# 循环判断
for f in fr:
    # 去除空格
    line = f.strip()
    if line.split(",")[1] == "测试":
        continue
    # 写入数据
    fw.write(line)
    # 写入换行
    fw.write("\n")

# 关闭文件
fr.close()
fw.close()
